<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>iframe加载时间计算与全屏显示</title>
    <style>
        .container {
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .iframe-container {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
        }

        #contentFrame {
            width: 100%;
            height: 100%;
            border: none;
            background: white;
        }


        .loader {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: #30303b;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 10;
            transition: opacity 0.5s ease;
        }

        .points {
            display: flex;
            justify-content: space-between;
            width: 90px;
            margin-bottom: 20px;
        }

        .box {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background-color: #fdb868;
            animation: moveUpDown 0.5s ease-in-out infinite;
        }

        .loading-text {
            font-size: 42px;
            color: #fdb868;
            margin-top: 15px;
        }

        @keyframes moveUpDown {

            0%,
            100% {
                transform: translateY(0px);
            }

            50% {
                transform: translateY(-35px);
            }

            65% {
                transform: translateY(-35px);
            }
        }

        .box:nth-child(1) {
            animation-delay: 0s;
        }

        .box:nth-child(2) {
            animation-delay: 0.05s;
        }

        .box:nth-child(3) {
            animation-delay: 0.1s;
        }
    </style>
</head>

<body>
    <div class="container">
        <div class="loader" id="loadingOverlay">
            <div class="points">
                <div class="box"></div>
                <div class="box"></div>
                <div class="box"></div>
            </div>
            <div class="loading-text">Loading</div>
        </div>

        <div class="iframe-container">
            <iframe id="contentFrame" src="http://192.168.0.6:81/client/gameinfo/paytable/?game_id=100"
                onload="loadingOff()" allow="unload"></iframe>
        </div> 
    </div>

    <script>
        // 更新尺寸指示器
        function updateSizeIndicator() {
            const loader = document.getElementById('loadingOverlay');
            const sizeValue = document.getElementById('sizeValue');

            const width = loader.offsetWidth;
            const percentageOn1 = width / 1080;

            loader.style.zoom = percentageOn1 * 100 + "%";
        }

        // 初始更新
        updateSizeIndicator();

        // 窗口大小改变时更新
        window.addEventListener('resize', updateSizeIndicator);

        function loadingOff() {
            console.log('loadingoff')
            const loadingOverlay = document.getElementById('loadingOverlay');
            // 隐藏加载动画
            setTimeout(() => {
                loadingOverlay.style.opacity = '0';
                setTimeout(() => {
                    loadingOverlay.style.display = 'none';
                }, 500);
            }, 500);
        }
    </script>
</body>

</html>